package com.bodgittandscarper.broker.types;

/**
 * This entity type is a modifiable version of the <code>Record</code> entity. 
 * 
 * 
 * @author Morten Rummelhoff
 *
 */
public interface RecordMod extends Record {
	/**
	 * Locks this record. Only locked records can be deleted or updated by the client who has locked it.
	 * This method can block if the record is already locked by another client.
	 */
	public void lock();
	/**
	 * Unlocks this record. 
	 */
	public void unlock();
	/**
	 * If the record is currently locked.
	 * 
	 * @return whether or not this record is locked.
	 */
	public boolean isLocked();
	/**
	 * Updates this record with field data. The array length must correspond with the actual number of fields in the database.
	 * 
	 * @param data specifies the updated field data
	 */
	public void updateRecordFields(String[] data);
	/**
	 * Sets the valid flag for this record.
	 * 
	 * @param valid whether or not this record is valid. Invalid records can be reused when new records are created. 
	 */
	public void setValid(boolean valid);
}
